package com.ssy.lingxi.order.model.bo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 交易流程规则
 * @author 万宁
 * @version 2.0.0
 * @date 2021-09-07
 */
public class TradeProcessBO implements Serializable {
    private static final long serialVersionUID = 8042010735718512534L;

    public TradeProcessBO(List<TradeProcessDetailBO> details) {
        details.stream().findFirst().ifPresent(detail -> {
            this.processKey = detail.getProcessKey();
            this.allProducts = detail.getAllProducts();
            this.hasContract = detail.getHasContract();
            this.contractId = detail.getContractId();
            this.payNodes = detail.getPayNodes();
            this.expireHours = detail.getExpireHours();
        });
        this.details = details;
    }

    /**
     * 流程Key
     */
    private String processKey;

    /**
     * 是否适用所有商品
     */
    private Boolean allProducts;

    /**
     * 是否使用电子合同
     */
    private Boolean hasContract;

    /**
     * 电子合同Id，如不使用合同，为0
     */
    private Long contractId;

    /**
     * 支付环节列表
     */
    private List<PayNodeBO> payNodes;

    /**
     * 订单取消时间
     */
    private BigDecimal expireHours;

    /**
     * 供应商及商品的交易流程配置详情
     */
    private List<TradeProcessDetailBO> details;

    public String getProcessKey() {
        return processKey;
    }

    public void setProcessKey(String processKey) {
        this.processKey = processKey;
    }

    public Boolean getAllProducts() {
        return allProducts;
    }

    public void setAllProducts(Boolean allProducts) {
        this.allProducts = allProducts;
    }

    public Boolean getHasContract() {
        return hasContract;
    }

    public void setHasContract(Boolean hasContract) {
        this.hasContract = hasContract;
    }

    public Long getContractId() {
        return contractId;
    }

    public void setContractId(Long contractId) {
        this.contractId = contractId;
    }

    public List<PayNodeBO> getPayNodes() {
        return payNodes;
    }

    public void setPayNodes(List<PayNodeBO> payNodes) {
        this.payNodes = payNodes;
    }

    public BigDecimal getExpireHours() {
        return expireHours;
    }

    public void setExpireHours(BigDecimal expireHours) {
        this.expireHours = expireHours;
    }

    public List<TradeProcessDetailBO> getDetails() {
        return details;
    }

    public void setDetails(List<TradeProcessDetailBO> details) {
        this.details = details;
    }
}
